import service from '@/utils/request'
import constant from '@/utils/constant'
import cache from '@/utils/cache'
import qs from "qs"

export const use${FunctionName}Api = (id: number) => {
  return service.get('/${moduleName}/${functionName}/' + id)
}

export const use${FunctionName}ExportApi = (queryForm: any) => {
  location.href = constant.apiUrl + '/${moduleName}/${functionName}/export?' + qs.stringify({ access_token: cache.getToken(), ...queryForm })
}

export const use${FunctionName}SubmitApi = (dataForm: any) => {
  if (dataForm.id) {
    return service.put('/${moduleName}/${functionName}', dataForm)
  } else {
    return service.post('/${moduleName}/${functionName}', dataForm)
  }
}